const db = wx.cloud.database();
import Dialog from '/@vant/weapp/dialog/dialog';





var queryText = "";
Page({
  data: {
    bh_list: []

  },

  onLoad() {
    var userinfo=wx.getStorageSync('userinfo')
    if(!userinfo){
      Dialog.alert({
        title: '登录',
        message: '请先登录',
      }).then(() => {
        wx.navigateTo({
          url: '../login/login',
        })
      });
    }

    db.collection('beadhouselist').get({
      success: res => {
        console.log(res);
        this.setData({
          bh_list: res.data
        })
        // console.log(this.data.bh_list)
      }
    })
  },
  //搜索功能
  q_button() {
    // for(){}
    queryText = "";
  },
  q_input(getText) {
    queryText = getText;

  },
  // 跳转详情页
  bh_list_tap(bh_int) {
    bh_int = bh_int.currentTarget.dataset.bh_int;
    wx.navigateTo({
      url: '../list_details/list_details?id=' + bh_int,

    })

  }
})